<?php

namespace Biz\model\brandFlowPool;

use Doraemon\pockets\datebase\BaseDbModel;

class FlowPoolWhite extends BaseDbModel
{

    const _CONFIG_FILE_ = 'db_store';

    const _CONFIG_SELECT_ = 'db_store';

    const _DATABASE_ = 'hhz_store';

    const _TABLE_NAME = 'brand_flow_pool_white';


    public static function getByWhere($where, $select = '*')
    {
        return self::get($select, $where);
    }

    public static function selectByWhere($where, $select = '*')
    {
        return self::select($select, $where);
    }

    public static function selectCountWhere($where)
    {
        return self::count('id', $where);
    }

    public static function insertData($data)
    {
        if (!isset($data['addtime']) || !$data['addtime']) {
            $data['addtime'] = date('Y-m-d H:i:s');
        }
        if (!isset($data['edittime'])) {
            $data['edittime'] = date('Y-m-d H:i:s');
        }
        $ret = self::insert($data);
        if ($ret->errorCode() !== '00000') {
            return false;
        }
        return self::id();
    }


    public static function updateData($data, $where)
    {
        if (!isset($data['edittime'])) {
            $data['edittime'] = date('Y-m-d H:i:s');
        }
        $ret = self::update($data, $where);
        if ($ret->errorCode() !== '00000') {
            return false;
        }
        return true;
    }


}

